7b24ff
@@ -3260,6 +3260,11 @@
public LockHandle acquireLock(String key) throws MetaException {
             if (!isDuplicateKeyError(ex)) {
               throw new RuntimeException("Unable to lock " + quoteString(key) + " due to: " + getMessage(ex), ex);
             }
+            //if here, it means a concrurrent acquireLock() inserted the 'key'
+
+            //rollback is done for the benefit of Postgres which throws (SQLState=25P02, ErrorCode=0) if
+            //you attempt any stmt in a txn which had an error.
+            dbConn.rollback();
           }
           rs = stmt.executeQuery(sqlStmt);
           if (!rs.next()) {
